import { createApp } from 'vue'
import { createPinia } from 'pinia'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import 'element-plus/theme-chalk/dark/css-vars.css'

import App from './App.vue'
import router from './router'
import errorHandlerPlugin from './plugins/error-handler'
import './styles/themes.css'

const app = createApp(App)

// 性能监控
if (import.meta.env.DEV) {
  // 开发环境下启用性能监控
  import('./composables/usePerformance').then(({ usePerformance }) => {
    const { startMonitoring } = usePerformance()
    startMonitoring()
  })
}

app.use(createPinia())
app.use(router)
app.use(ElementPlus)
app.use(errorHandlerPlugin)

app.mount('#app')